
<template>
  <n-menu
      :collapsed-width="64"
      :collapsed-icon-size="22"
      :options="mainMenuOptions"
      :collapsed="props.collapsed"
      :mode="props.model"
  />
</template>

<script setup lang="ts">
//@ts-ignore
import {useUserConfig} from "/@bean/GlobalConfig";
import {
  BarChart,
  BarChartOutline,
  ListOutline,
  LibraryOutline,
  MoonOutline,
  HomeOutline,
  GlobeOutline,
  MapOutline,
  PieChartOutline,
  PeopleOutline,
  PeopleSharp,
  SearchOutline,
  AnalyticsOutline,
  ChatboxSharp,
  ChatboxOutline 
} from '@vicons/ionicons5'
import {h, reactive, ref, toRefs} from "vue";
import {storeToRefs} from "pinia";
//@ts-ignore
import {renderIcon} from "/@utils/GlobalFunction";
import {RouterLink} from "vue-router";

//props
const props = defineProps({
  model : {
    type: String,
    default: 'vertical' // vertical | horizontal
  },
  collapsed: {
    type: Boolean,
    default: false
  }
});


const storesUserConfig = useUserConfig();
const { userInfo } = storeToRefs(storesUserConfig);

const is_superuser = userInfo.value.is_superuser;
// 菜单栏配置
const mainMenuOptions = reactive([
  {
    label: () => h(
        RouterLink,
        {
          to: '/',
        },
        {default: () => '首页'}
    ),
    key: 'home',
    icon: renderIcon(HomeOutline),
  },
  {
    label: '用户管理',
    key: 'user',
    show:is_superuser,
    icon: renderIcon(PeopleOutline),
    children: [
      {
        label: () => h(
            RouterLink,
            {
              to: '/admin/UserList',
            },
            {default: () => '用户列表'}
        ),
        icon: renderIcon(PeopleSharp),
        key: 'user-list',
      }
    ]
  },
  {
    label: '数据管理',
    key: 'mydata',
    show:is_superuser,
    icon: renderIcon(LibraryOutline),
    children: [
        
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/AgeCount-Page',
                    },
                    {default: () => '年龄计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'AgeCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/CommitCount-Page',
                    },
                    {default: () => '提交计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'CommitCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/CreationTimeCount-Page',
                    },
                    {default: () => '创建时间计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'CreationTimeCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/GenderCount-Page',
                    },
                    {default: () => '性别计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'GenderCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/GoodsIdCount-Page',
                    },
                    {default: () => '货物id计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'GoodsIdCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/ImgCount-Page',
                    },
                    {default: () => 'img计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'ImgCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/JdGood-Page',
                    },
                    {default: () => 'jd好'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'JdGood',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/KeywordCount-Page',
                    },
                    {default: () => '关键字计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'KeywordCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/PriceCount-Page',
                    },
                    {default: () => '价格计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'PriceCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/ShopCount-Page',
                    },
                    {default: () => '店铺数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'ShopCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/ShopIdCount-Page',
                    },
                    {default: () => '店铺id计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'ShopIdCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/TitleCount-Page',
                    },
                    {default: () => '标题计数'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'TitleCount',
            },
            
            {
                label: () => h(
                    RouterLink,
                    {
                        to: '/UserGood-Page',
                    },
                    {default: () => '用户良好'}
                ),
                icon: renderIcon(MoonOutline),
                key: 'UserGood',
            },
            
    ]
  },
  {
    label: '大屏管理',
    key: 'bigscreen',
    icon: renderIcon(PeopleOutline),
    children: [
      {
        label: () => h(
            RouterLink,
            {
              to: '/bigScreen',
            },
            {default: () => '汇总数据'}
        ),
        icon: renderIcon(PeopleSharp),
        key: 'data-all',
      },
      {
        label: () => h(
            RouterLink,
            {
              to: '/bigScreen1',
            },
            {default: () => '性别统计'}
        ),
        icon: renderIcon(PeopleSharp),
        key: 'data-key1',
      },
      {
        label: () => h(
            RouterLink,
            {
              to: '/bigScreen2',
            },
            {default: () => '商品类别统计'}
        ),
        icon: renderIcon(PeopleSharp),
        key: 'data-key2',
      }
      ,
      {
        label: () => h(
            RouterLink,
            {
              to: '/bigScreen3',
            },
            {default: () => '年龄排行'}
        ),
        icon: renderIcon(PeopleSharp),
        key: 'data-key3',
      },
      {
        label: () => h(
            RouterLink,
            {
              to: '/bigScreen4',
            },
            {default: () => '商品搜索'}
        ),
        icon: renderIcon(PeopleSharp),
        key: 'data-key4',
      },
      // {
      //   label: () => h(
      //       RouterLink,
      //       {
      //         to: '/bigScreen5',
      //       },
      //       {default: () => '数据5'}
      //   ),
      //   icon: renderIcon(PeopleSharp),
      //   key: 'data-key5',
      // },
      // {
      //   label: () => h(
      //       RouterLink,
      //       {
      //         to: '/bigScreen6',
      //       },
      //       {default: () => '销量预测'}
      //   ),
      //   icon: renderIcon(PeopleSharp),
      //   key: 'data-key6',
      // },
      // {
      //   label: () => h(
      //       RouterLink,
      //       {
      //         to: '/bigScreen7',
      //       },
      //       {default: () => '价格预测'}
      //   ),
      //   icon: renderIcon(PeopleSharp),
      //   key: 'data-key7',
      // }
    ]
  },
])
</script>

<style scoped>

</style>
    